<template>
  <el-dialog title="查看报告单" :visible.sync="dialogFormVisible" :append-to-body="true" width="65%" @close="handleClose" @open="handleOpen" :close-on-click-modal="false" :close-on-press-escape="false">
      <el-row :gutter="20">
        <el-col :span="10">报告单:：{{reportTemplateInfo.caseReportName}}</el-col>
        <el-col :span="10">是否配置算法： {{reportTemplateInfo.isPictureAlgorithm ? '是' : '否'}}</el-col>
      </el-row>
      <el-row :gutter="20"  v-if="reportTemplateInfo.isPictureAlgorithm">
        <el-col :span="10">图片算法： {{ reportTemplateInfo.pictureAlgorithmName }}</el-col>
      </el-row>
      <el-row :gutter="20"  v-if="reportTemplateInfo.isPictureAlgorithm">
        <el-col :span="10">参数池： </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-table
        border
        size="small"
        :data="tableData"
        style="width: 100%;height: 300px;overflow-y: auto;">
        <el-table-column
          label="#"
          type="index"
          width="50">
        </el-table-column>
        <el-table-column 
          v-for="(item, index) in tableHeader"
          :key="item.headCode + index"
          :prop="item.headCode"
          :label="item.headName">
          <template slot-scope="scope">
            <div class="norm-config" v-if="item.isRange">
              <div class="config-info">
                <span>范围: {{ scope.row[item.headCode + '_min']}} ~ {{ scope.row[item.headCode + '_max']}}</span>
              </div>
            </div>
            <div class="norm-config" v-else>
               <span>{{ scope.row[item.headCode] }}</span>
            </div>
          </template>
        </el-table-column>
        </el-table>
      </el-row>
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { getDetail } from "@/api/featureManager/reportCard";
export default {
  data() {
    return {
      dialogFormVisible: false,
      reportTemplateInfo: {},
      tableHeader: [],
      tableData: []
    }
  },
  props: {
    currentId: String
  },
  methods: {
    // 打开弹窗回调事件
    handleOpen () {
      getDetail(this.currentId).then(res => {
        debugger
        this.reportTemplateInfo = res.data.data
        this.tableHeader = res.data.data.tableHeadDataTypeVOS
        this.tableData = res.data.data.mapList
      })
    },
    // 关闭弹窗
    handleClose() {
      this.tableData = []
      this.reportTemplateInfo = {}
      this.tableHeader = []
      this.dialogFormVisible = false
    }
  }
};
</script>
  
<style scoped>
</style>
  